<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
        <style type="text/css">
	       .hy-js-fieldarea label{ border: 2px solid #ddd; width: 100%;background: #ddd;height: 40px;border-radius: 4px;line-height: 30px;padding-left: 10px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
        </style>
	</head>
	<body>
	<div class="am-g">
		 {include file='../Common/hy_header.html'}
		<div class="am-tabs am-margin" data-am-tabs="">
    <ul class="am-tabs-nav am-nav am-nav-tabs">
      <li class="am-active"><a hidefocus="true" href="#tab1">基本选项</a></li>
      <li class=""><a hidefocus="true" href="#tab2">字段管理</a></li>
    </ul>


    <form class="am-tabs-bd am-form hy-js-form" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
      
      <div class="am-tab-panel am-fade am-active am-in" id="tab1">
          <div class="am-g am-margin-top">
            <div class="am-u-sm-2 am-text-right">
                  表单标题
            </div>
            <div class="am-u-sm-4 am-u-end">
              <input type="text" name="title" value="{$art.title}" class="am-input-sm">
            </div>
          </div>

          

          <div class="am-g am-margin-top">
            <div class="am-u-sm-2 am-text-right">
                       时间间隔
            </div>
            <div class="am-u-sm-4 am-u-end">
               <div class="am-btn-group" data-am-button="">
									<label class=" am-btn am-btn-default am-btn-xs am-active">
										<input type="radio" name="interval" {if $menu.is_extend_links}{if $menu.is_extend_links eq 0}checked="checked" {else}{/if}{else}checked="checked" {/if}  value="86400">
										一天
									</label>
									<label class="am-btn am-btn-default am-btn-xs">
										<input type="radio" name="interval" {if $menu.is_extend_links eq 1}checked="checked" {else}{/if} value="10800"> 
										三小时
									</label>
									<label class="am-btn am-btn-default am-btn-xs">
										<input type="radio" name="interval" {if $menu.is_extend_links eq 1}checked="checked" {else}{/if} value="-1"> 
										只能一次
									</label>
									<label class="am-btn am-btn-default am-btn-xs">
										<input type="radio" name="interval" {if $menu.is_extend_links eq 1}checked="checked" {else}{/if} value="0"> 
										无限制
									</label>
								</div>
            </div>
          </div>

       <div class="am-g am-margin-top">
            <div class="am-u-sm-2 am-text-right">
              有效日期
            </div>
            <div class="am-u-sm-2">
             <div class="am-form-group am-form-icon">
                <i class="am-icon-calendar"></i>
                <input name="stime" data-am-datepicker value="{$art.created|date_format:'%Y-%m-%d'}" type="text" class="am-form-field am-input-sm" placeholder="开始时间">
              </div>
            </div>
            <div class="am-u-sm-2 am-u-end">
             <div class="am-form-group am-form-icon">
                <i class="am-icon-calendar"></i>
                <input name="etime" data-am-datepicker value="{$art.created|date_format:'%Y-%m-%d'}" type="text" class="am-form-field am-input-sm" placeholder="结束时间">
              </div>
            </div>
          </div>
      </div>
      
      
      <div class="am-tab-panel am-fade" id="tab2">
      	     <div class="am-g am-margin-top">
            <div class="am-u-sm-2 am-text-right">
              <select id="field-list" name="">
              	<option value="0">请选择字段</option>
      	    	 {foreach from=$field_list item=list}
      	    	<option value="{$list.id}">{$list.name}</option>
      	    	{/foreach}
      	    </select>
            </div>
            <div class="am-u-sm-2">
              <input type="checkbox" name="require" id="require" value="1" />必填
            </div>
            <div class="am-u-sm-2 am-u-end">
             <a class="am-btn am-btn-primary am-btn-xs hy-js-addfield" >添加字段</a>
            </div>
          </div>
             <div class="am-g am-margin-top">
             	  <div class="am-u-sm-4 am-u-end hy-js-fieldarea">
             	  	
             	  </div>
             </div>
      	   <!--<ul class="hy-js-fieldarea" id="hy-img-ul">
      	   	{foreach from=$art.photo item=photo}
      	   	<li class="hy-img-li">
      	   		<div  class="hy-img-container am-text-right "><span data-param ="{ url:'index.php?g=admin&m=article&a=del_photo&id={$photo.id}',hide:2}" class="hy-js-del am-icon-close"></span><img data-href="index.php?g=admin&m=article&a=edit_photo&pid={$photo.id}" class="hy-js-img" title="{$photo.title}" alt="{$photo.title}" width="100%" src="{$photo.original_pic}"/></div>
      	   	</li>
      	   	{/foreach}
      	   </ul>-->
      </div>
      
 <input type="hidden" name="id" value="{$id}" />
    </form>
    <div class="am-margin">
    <button type="button" class="am-btn am-btn-primary hy-js-submit am-btn-xs">提交保存</button>
    
  </div>
  </div>
	</div>	
	 
	  {include file='../Common/hy_footer.html'}
	<script type="text/javascript">
	    $('.hy-js-addfield').click(function(e){
	    	e.preventDefault();
	    	var _this=$(this);
	    	var key=_this.parent().parent().find('#field-list').val();
	    	if(key==0)
	    	{
	    		alert('请选择字段');
	    		return;
	    	}
	    	var list_text=_this.parent().parent().find('#field-list').find("option:selected").text();
	    	var require=_this.parent().parent().find('#require:checked').val();
	    	var re_text='必填';
	    	if(typeof(require)=='undefined')
	    	{
	    		require=0;
	    		re_text='非必填';
	    	}
	    	val="["+require+"]"
	    	{literal}
	    	var json='{"k":"'+key+'","r":"'+val+'"}';
	    	{/literal}
	    	var html='<label class="am-icon-close hy-js-delfield" style="border:2px solid #0e90d2"> '+list_text+'-'+re_text+'<input checked="checked" type="hidden" class="hy-hide" name="fields" id="" value=\''+json+'\'></label>'
	    	_this.parent().parent().parent().find('.hy-js-fieldarea').append(html);
	    	//清空数据
	    	
	    });
	    
	    $('.hy-js-delfield').live('click',function(){
			    	if(confirm('你确定要删除这个字段吗？'))
			    	{    var _this=$(this);
			    	   _this.remove();
			    	}
			   });
	    hy_submit('index.php?g=admin&m=forms&a={$action}');
	</script>
	</body>
</html>
